<#assign menuId=4>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>大货订单-${Application.systemName!}</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <!-- bootstrap 3.0.2 -->
        <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="../css/ionicons.min.css" rel="stylesheet" type="text/css" />
        <!-- Theme style -->
        <link href="../css/AdminLTE.css" rel="stylesheet" type="text/css" />

        <link href="../css/myself.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="../css/pagination.css" />
        <link rel="stylesheet" type="text/css" href="../css/bootstrap-select.css">
		<link rel="stylesheet" type="text/css" href="../css/datetimepicker/bootstrap-datetimepicker.min.css"/>
  
        <script type="text/javascript" src="../js/lib/jquery.min.js"></script>

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
		<style type="text/css">
			.user-header ul{
				margin-top: 20px; 
				margin-left: 5px;
			}
			.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
			    vertical-align: middle;
			}
			.table tr td:nth-child(1) {
				min-width: 430px;
			}
			.user-header ul li{
				color: rgba(255, 255, 255, 0.8);
				text-align: left; 
				margin-top: 20px;
				font-size: 17px;
			}
		   .r_input{width: 18%;height: 2em;}
	        .r_select{width: 15%;height: 2em;}
	        .grey{color: #ddd;}
	        input[type="radio"], input[type="checkbox"]{margin-right: 5px;}
	        .btn.btn-success{padding:6px 12px;}
	        .btn.btn-default{padding:6px 12px;}
	        .gongchang_btn button{
	        	margin-bottom: 10px;
	        }
	        .style-image img{
	        	width: 120px;
	        	height: 100px;
	        }
	        
			/* 弹出大图样式 */
			.Image{
				width: 960px;
			}
			.Image .modal-body {
				position: relative;
			}
			.Image .modal-body img{
				width: 100%;
				height: 540px;
				cursor: pointer;
				position: absolute;
				top: 0;
				left: 0;
				z-index:99;
			}
			.iconR, .iconL{
				position: absolute;
				top: 50%;
				font-size: 50px;
				color: #3882ff;
				cursor: pointer;
				opacity: 0.7;
				margin-top: 20%;
				z-index:2000;
			}
			.iconL{
				left: 10px;
			}
			.iconR{
				right: 10px;
			}
			.tc2_content1_d2{
                width: 90px;
                height: 30px;
                background-color: #5f6571;
                color: #fff;
                text-align: center;
                line-height: 30px;
                border-radius: 15px 0 0 15px;
                position: absolute;
                right: 0;
                top: 20px;
                font-weight: bold;
                z-index:999;
            }
            
            .left-side{
            	display: block;
            }
            
            
            
            
		</style>
    </head>
    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
         <#include "../header.html"/>
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <#include "../menu.html"/>

            <!-- Right side column. Contains the navbar and content of the page -->
           <aside class="right-side">
           	<section class="content-header" style="position: relative;">
                    <h1>大货订单</h1>
               		<hr style="margin: 10px 0 0 0" />
            </section>
            <section class="content">
            	<div class="row">
            		<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            			<div class="box">
            				<div class="clearfix search-div center">
                            	<div class="design-order-top clearfix"  style="margin-bottom: 15px;">
					                <div  class="fl clearfix">
	                                    <div class="btn-group" data-toggle="btn-toggle">
	                                 
	                                    
	                                        <button type="button" onclick="window.location.href='list?pageNo=1'"  class="btn btn-default btn-md <#if status??><#else>active</#if>">全部</button>
	                                       
	                                        <button type="button" onclick="window.location.href='list?status=30'" class="btn btn-default btn-md <#if status?? && status==30>active</#if>">待安排</button>
	                                        <button type="button" onclick="window.location.href='list?status=31'" class="btn btn-default btn-md <#if status?? && status==31>active</#if>">待推码</button>
	                                        <button type="button" onclick="window.location.href='list?status=32'" class="btn btn-default btn-md <#if status?? && status==32>active</#if>">生产中</button>
	                                        <button type="button" onclick="window.location.href='list?status=33'" class="btn btn-default btn-md <#if status?? && status==33>active</#if>">待发货</button>
	                                        <button type="button" onclick="window.location.href='list?status=34'" class="btn btn-default btn-md <#if status?? && status==34>active</#if>">待签收</button>
	                                        <button type="button" onclick="window.location.href='list?status=35'" class="btn btn-default btn-md <#if status?? && status==35>active</#if>">待收费</button>
	                                        
	                                        <button type="button" onclick="window.location.href='list?status=99'" class="btn btn-default btn-md <#if status?? && status==99>active</#if>">已完成</button>
	                                        
	                                    </div>
					                </div>
	            				</div>
	            				
	            				
	            				<div class="search1">
					            	<form id="search_form" action="../productionorder/list" method="get">
					            	
					            	
					            	<ul style="padding: 0"> 
							       			<li>
												<input type="text" name="code" value="${code!}" placeholder="输入订单号"/>
							       			</li>
							       			<li>
												<input type="text" name="customerName" value="${customerName!}" placeholder="输入公司名或简称"/>
							       			</li>
							       			<li>
												<select class="input-md" id="category" name="factoryId" >
	                                                <option value="">选择工厂</option>
	                                                <#list factoryList as factory>
	                                                <#if factoryId??>
	                                                	<#if factory.id == factoryId>
	                                                		<option value="${factory.id!}" selected="selected">${factory.name!}</option>
	                                                	<#else>
	                                                		<option value="${factory.id!}">${factory.name!}</option>
	                                                	</#if>
	                                                <#else>
	                                                	<option value="${factory.id!}">${factory.name!}</option>
	                                                </#if>
													</#list>
	                                        	</select>
							       			</li>
							       		 	<li>
							       		 		<select class="input-md" id="level" name="managerId">
	                                                <option value="">选择项目经理</option>
	                                                <#list managerList as manager>
	                                                <#if managerId??>
	                                                	<#if manager.id == managerId>
	                                                		<option value="${manager.id!}" selected="selected">${manager.name!}</option>
	                                                	<#else>
	                                                		<option value="${manager.id!}">${manager.name!}</option>
	                                                	</#if>
	                                                <#else>
	                                                	<option value="${manager.id!}">${manager.name!}</option>
	                                                </#if>
													</#list>
	                                        	</select>
							       		 	</li>
							       		 	<li>
							       		 		<select class="input-md" id="level" name="saleId">
	                                                <option value="">选择销售</option>
	                                                <#list saleList as sale>
	                                                <#if saleId??>
	                                                	<#if sale.id == saleId>
	                                                		<option value="${sale.id!}" selected="selected">${sale.name!}</option>
	                                                	<#else>
	                                                		<option value="${sale.id!}">${sale.name!}</option>
	                                                	</#if>
	                                                <#else>
	                                                	<option value="${sale.id!}">${sale.name!}</option>
	                                                </#if>
	                                                </#list>
	                                        	</select>
							       		 	</li>
							       			<li>
							       				<div>
				                                    <button type="submit" class="btn btn-primary btn-sm">搜索</button>
		                                		</div>
							       			</li>
							       		</ul>
                            		</form>
							    </div>
                            </div><!-- /.box-header -->
            				
				            <div class="clearfix search-div center" style="margin-top:0">
						       	<div class="clearfix"></div>
						       	<form action="#" method="get">
						           	<table class="table table-bordered text-center">
						               	<tbody>
						                   	<tr>
						                       <th style="border: 0;" width="36%">客户信息</th>
						                       <th style="border: 0;" width="16%">大货数量</th>
						                       <th style="border: 0;" width="16%">工厂</th>
						                       <th style="border: 0;" width="16%">状态</th>
						                       <th style="border: 0;" width="16%">操作</th>
						                   	</tr>
						               	</tbody>
						           	</table>
                                	<#list productionOrders as productionOrder>
                                	<table class="table table-bordered text-center order-list">
                                		<tr>
				                    		<td  colspan="5"  class="left-text" style="font-weight: bold;">
				                    			<div class="pull">
				                    				<span class="pull-left" style="border: none;">
					                    				<span>
					                    					<!-- <input type="checkbox" /> -->
					                    					${productionOrder.createAt?string("yyyy/MM/dd")}
					                    				</span>&nbsp;&nbsp;&nbsp;
					                    				<span>订单号：${productionOrder.code!}</span>
					                    			</span>
					                    			<span class="pull-right">
					                    				<span>客户交期：</span>
					                    				<span class="red">剩余2天</span>
					                    			</span>
				                    			</div>
				                    		</td>
				                    	</tr>
                                		<tr>
				                    		<td style="border: 0; width: 36%; text-align: left;">
				                    			<#if productionOrder.customer.level=="V1">
					                            <i class="iconfont fl">&#xe6eb;</i>
					                            <#elseif productionOrder.customer.level=="V2">
					                            <i class="iconfont fl">&#xe6ed;</i>
					                            <#else>
					                            <i class="iconfont fl">&#xe6e9;</i>
					                            </#if>
					                            <div  class="order-text">
						                            <p>
							                            <a id="name" href="../customer/doShowCustomerDetailPage?id=${productionOrder.customer.id!}">${productionOrder.customer.fullname!}</a>
							                            <#if productionOrder.customer.web??  && productionOrder.customer.web!="">
							                            <a href="${productionOrder.customer.web}"><i class="iconfont">&#xe6ee;</i></a>
							                            </#if>
							                            <#if productionOrder.customer.attachment?? && productionOrder.customer.attachment?size!=0>
							                            <a href="javascript:;"><i class="iconfont" data-toggle="modal" data-target="#myModal1">&#xe6ef;</i></a>
						                            	<!-- 下载列表 -->
						                            	<div class="modal fade" id="myModal1"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
															<div class="modal-dialog down_load">
																<div class="modal-content"> 
																	<div class="modal-header">
																		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
																			&times;
																		</button>
																		<h4 class="modal-title">
																			下载列表
																		</h4>
																	</div>
																	<div class="modal-body"> 
																		<ul>
																			<#list productionOrder.customer.attachment as attach>
																			<li>
																				<div class="clearfix">
																					<a href="../businessfile/downFile?businessFileId=${attach.id!}"><img class="pull-left" src="../img/file.png" style="width: 60px; height: 60px; border-radius: 10px;"/></a>
																					<span class="pull-left" title="${attach.originName!}">${attach.originName!}</span>
																				</div>
																			</li>
																			</#list>
																		</ul>
																	</div>
																	<div class="modal-footer">
																		<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
																	</div>
																</div><!-- /.modal-content -->
															</div><!-- /.modal -->
														</div>
						                            	</#if>
						                            </p>
						                            <p>产品分类：<#list productionOrder.customer.productCategory as ca>${ca!}&nbsp;</#list> 目标人群：${productionOrder.customer.targetConsumer!}</p>
						                            <p><i class="iconfont">&#xe6f4;</i>
				                    				客户需求：${productionOrder.requirement!}</p>
					                            </div>
				                    		</td>
				                    		<td style="border-bottom: 0; width: 16%;">${productionOrder.productionPatternResults?size}</td>
				                    		<td style="border-bottom: 0; width: 16%;"></td>
				                    		<td style="border-bottom: 0; width: 16%;"  class="red">  		
				                    		<#if productionOrder.status==30>待安排<#elseif productionOrder.status==31>待推码
				                		<#elseif productionOrder.status==32>生产中<#elseif productionOrder.status==32>待发货<#elseif productionOrder.status==34>待签收<#elseif productionOrder.status==99>已完成</#if>
				                		
				                		</td>
				                		
				                    		<td style="border-bottom: 0;width: 16%"><a href="detail?id=${productionOrder.id}">订单详情</a></td>
				                    	</tr>
				                    	<#if productionOrder??>
				                    	<#list productionOrder.productionPatternResults as productionPatternResult>
                                		<tr>
				                    		<td  style="border: 0; padding-top: 0;" colspan="5">
				                    			<table class="table table-bordered text-center order-list">
				                    				<tr>
								                       	<td colspan="5" class="left-text" style="font-weight: bold;">
								                       		<input type="checkbox" />
								                           	<span>子订单号：${productionPatternResult.code!}</span>
								                       	</td>
								                   	</tr>
				                    				<tr>
				                    					<td style="width: 36%; text-align: left;">
							                    			<div class="style-content">
							                    				<span class="style-image" onclick="showImage('${productionPatternResult.orderPatternId!}','${productionPatternResult.mainImage!}')">
								                    				<img src="${Application.accessFileUrl}${productionPatternResult.mainImage!}" alt="款式图"  alt="款式图1" data-toggle="modal" data-target="#show_image" />
								                    			</span>
								                    			<span class="style-number">
								                    				<div>设计编号：${productionPatternResult.patternNo!}</div>
								                    				<div style="color: #bbb;">创建时间：<#if productionOrder.createAt??>${productionOrder.createAt?string("yyyy-MM-dd HH:mm")}</#if></div>
								                    			</span>
								                    			<div class="clear" style="clear: both;"></div>
							                    			</div>
							                    		</td>
							                    		<td style="width: 16%;">1</td>
							                    		<td style="width: 16%;"><#if productionPatternResult.factory??>${productionPatternResult.factory.name!}</#if></td>
							                    		<td style="width: 16%;">
							                    		<#if productionPatternResult.status==30>待安排<#elseif productionPatternResult.status==31>待推码
				                		<#elseif productionPatternResult.status==32>生产中<#elseif productionPatternResult.status==32>待发货<#elseif productionPatternResult.status==34>待签收<#elseif productionPatternResult.status==35>待付款<#elseif productionPatternResult.status==99>已完成</#if></td>
				                		
				                		</td>
							                    		<td class="gongchang_btn" width="16%">
							                    		<#if (Session["permisionMap"]["F301"]??)  && productionPatternResult.status==31>
							  
							                    		<div class="">

							                    		<button type="button" onclick="tmAdd(${productionPatternResult.id});" class="btn btn-primary btn-sm">${Session["permisionMap"]["F301"].name!}</button>


							                    		</div>
							                    		</#if>
							                    		<#if (Session["permisionMap"]["F302"]??)  && productionPatternResult.status==32>
							                    			   			<a href="../productionpattern/addProduceDate?productionId=${productionPatternResult.id}">${Session["permisionMap"]["F302"].name!}</a>
															
							                    		</#if>
							                    		<#if (Session["permisionMap"]["F306"]??)  && productionPatternResult.status==32>
							                    			<br>
							              <a href="../productionpattern/addLastReport?productionId=${productionPatternResult.id}">${Session["permisionMap"]["F306"].name!}</a>
															   
							                    		</#if>
							  
							                   
							                    		<#if (Session["permisionMap"]["F303"]??)  && productionPatternResult.status gt 32 && productionPatternResult.status lt 99>
							                    		<div>
							                    			<button type="button" onclick="window.location.href='../encasement/add?productionPatternId=${productionPatternResult.id}'" class="btn btn-primary btn-sm">填写装箱单</button>
							                    		</div>
							                    		
							                    		</#if>
							                    		<#if (Session["permisionMap"]["F304"]??)  && productionPatternResult.status==34>
							                    		
														<div>
															<button type="button" onclick="window.location.href='../encasement/addArrivedate?productionPatternId=${productionPatternResult.id}'" class="btn btn-primary btn-sm">输入到货日期</button>
														</div>
							                    		</#if>
							                    		<#if (Session["permisionMap"]["F305"]??)  && productionPatternResult.status==35>
							                    		
														<div>
															<button type="button" onclick="saveFee(${productionPatternResult.id})" class="btn btn-primary btn-sm">付款</button>
														</div>
							                    		</#if>
							                    		</td>	
				                    				</tr>
				                    			</table>
				                    		</td>
				                    	</tr>
				                    	</#list>
				                    	</#if>
						       		</table>
						       		</#list>
						       	</form>
							    <div class="box-footer ">
									<ul class="pagination pagination-sm no-margin pull-right">
										 <#if splitPage??> ${splitPage?replace("{url}","${url!}")}
										</#if>
									</ul>
								</div>
				           	</div>
            			</div>
            		</div>
            	</div>
            </section>
            </aside><!-- /.right-side -->
           <div class="modal fade" id="show_image" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog Image">
					<div class="modal-content">
						<div class="modal-body">
							<i class="fa fa-chevron-right iconR"></i>
							<i class="fa fa-chevron-left iconL"></i>
							<div class="tc2_content1_d2">&lt;   <span id="num">1</span>  /   <span id="max">1</span>   &gt;</div>
						</div>
					</div><!-- /.modal-content -->
				</div><!-- /.modal -->
			</div>
            
            <input type="hidden"  id="productionPatternId"/>
           	
			<#include "production_contract_add.html"/>
			<#include "production_tm_add.html"/>
			
        </div><!-- ./wrapper -->
        
        <script src="../js/jquery.min.js" type="text/javascript"></script>
        <!-- Bootstrap -->
        <script src="../js/bootstrap.min.js" type="text/javascript"></script>
        <!-- AdminLTE App -->
        <script src="../js/AdminLTE/app.js" type="text/javascript"></script>
        <script type="text/javascript" src="../js/bootstrap-select.js"></script> 
        		<script src="../js/jquery.form.min.js"></script>
        <!--datepickes-->
		<script src="../js/plugins/datetimerpicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
	
		<script src="../js/plugins/datetimerpicker/locales/bootstrap-datetimepicker.zh-CN.js" type="text/javascript"></script>
        <script type="text/javascript">
        
			$(function() {
			    $('.form_datetime').datetimepicker({
			    	format: 'yyyy-mm-dd hh:00',
			       	language:  'zh-CN',  
		            weekStart: 1,  
		            todayBtn:  1,  
		            autoclose: 1,  
		            todayHighlight: 1,  
		            startView: 2,  
		            forceParse: 0,  
		            showMeridian: 0,
		            minView: 1,
		            startDate: new Date()
			    });
 
        	});
			function saveFee(id){
				
				$.ajax({  
		            type : "POST",  //
		            url : "../productionpattern/saveFee?id="+id,
		            data : {  
		            	
		            },
		            success : function(map) {
		 
		            	if(map.head.respCode=="0000000"){
		                	alert("提交成功");
		                	window.location.href="list";
		                }else{
		                	alert(map.body);
		                }
		            }  
		        }); 
			}
			//搜索按钮的点击事件
			$('#search').click(function(){
				$('#search_form').submit();
			});
			
			/* 弹出图片框鼠标悬浮事件 */
	        $('.iconR').hide();
			$('.iconL').hide();
	        
	        $( ".Image" ).hover(
			  function() {  
				  $('.iconR').show();
				    $('.iconL').show();  
				  }, function() {  
					  $('.iconR').hide();
					    $('.iconL').hide(); 
				  } 
			); 
			
			function showImage(id,main){
	        	$.ajax({
	        		url:'../orderpattern/showImage',
	        		type:'get',
	        		data:{orderPatternId:id},
	        		dataType:'json',
	        		async:false,
	        		success:function(result){
	        			if(result.head.respCode='0000000'){
	        				var image=result.body;
	        				var div=$('#show_image').find('.modal-body');
	        				div.find('img').remove();
	        				div.find('#max').html(image.length);
	        				for(var i=0;i<image.length;i++){
	        					var path='${Application.accessFileUrl}'+image[i];
	        					var img=$('<img src="'+path+'"></img>');
	        					div.find('.iconR').before(img);
	        					img.hide();
	        					if(image[i]==main){
	        						div.find('#num').html(i+1);
	        						img.show();
	        					}
	        				}
	        				div.find('.iconR').click(next);
	        				div.find('.iconL').click(last);
	        			}
	        		}
	        	});
	        }
	        function next(){
	        	var span=$(this).parent().find('#num');
	        	var num=span.html();
	        	num=parseInt(num);
	        	var max=$(this).parent().find('#max').html();
	        	if(num==max) return;
	        	$(this).parent().find('img').eq(num).show();
	        	$(this).parent().find('img').eq(num-1).hide();
	        	span.html(++num);
	        }
	        
	        function last(){
	        	var span=$(this).parent().find('#num');
	        	var num=span.html();
	        	num=parseInt(num);
	        	if(num==1) return;
	        	$(this).parent().find('img').eq(num-2).show();
	        	$(this).parent().find('img').eq(num-1).hide();
	        	span.html(num-1);
	        }
        </script>
     
    </body>
</html>

